package com.bfsoft.springbootinit.controller;

import com.bfsoft.springbootinit.pojo.dto.IdDTO;
import com.bfsoft.springbootinit.pojo.vo.ResultVO;
import com.bfsoft.springbootinit.pojo.vo.TaskVo;
import com.bfsoft.springbootinit.service.FlowableTestService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;


@Slf4j
@RestController
@Setter ( onMethod_ = @Resource )
@RequestMapping ( "/flowable/test" )
@Tag ( name = "flowable测试", description = "flowable测试" )
public class FlowableTestController {


	private FlowableTestService flowableTestService;

	@PostMapping ( "/getStartNextNode" )
	@Operation ( summary = "发起流程时获取下一节点候选组信息", description = "发起流程时获取下一节点候选组信息" )
	public ResultVO < Object > getStartNextNode ( @RequestBody TaskVo dto ) {
		return flowableTestService.getStartNextNode ( dto );
	}

	@PostMapping ( "/getApprovalNextNode" )
	@Operation ( summary = "审批时获取下一节点候选组信息", description = "审批时获取下一节点候选组信息" )
	public ResultVO < Object > getApprovalNextNode ( @RequestBody TaskVo dto ) {
		return flowableTestService.getApprovalNextNode ( dto );
	}

	@PostMapping ( "/startProcess" )
	@Operation ( summary = "启动流程", description = "启动流程" )
	public ResultVO < Object > startProcess ( @RequestBody TaskVo dto ) {
		return flowableTestService.startProcess ( dto );
	}

	@Operation ( summary = "我发起的流程", description = "我发起的流程" )
	@PostMapping ( value = "/myProcessList" )
	public ResultVO < Object > myProcessList ( @RequestBody TaskVo dto ) {
		return flowableTestService.myProcessList ( dto );
	}

	@PostMapping ( "myTodoList" )
	@Operation ( summary = "我的待办任务", description = "我的待办任务" )
	public ResultVO < Object > myTodoList ( @RequestBody TaskVo dto ) {
		return flowableTestService.myTodoList ( dto );
	}

	@PostMapping ( "finishedList" )
	@Operation ( summary = "我的已办任务", description = "我的已办任务" )
	public ResultVO < Object > finishedList ( @RequestBody TaskVo dto ) {
		return flowableTestService.finishedList ( dto );
	}

	@Operation ( summary = "审批任务", description = "审批任务" )
	@PostMapping ( value = "/complete" )
	public ResultVO < Object > complete ( @RequestBody TaskVo taskVo ) {
		return flowableTestService.complete ( taskVo );
	}

	@Operation ( summary = "根据流程实例id获取审批详情", description = "根据流程实例id获取审批详情" )
	@PostMapping ( value = "/getProcessDetail" )
	public ResultVO < Object > getProcessDetail ( @RequestBody TaskVo taskVo ) {
		return flowableTestService.getProcessDetail ( taskVo );
	}


	@Operation ( summary = "根据系统ID获取定义的流程", description = "根据系统ID获取定义的流程" )
	@PostMapping ( value = "/getSystemProcessList" )
	public ResultVO < Object > getSystemProcessList ( @RequestBody IdDTO dto ) {
		return flowableTestService.getSystemProcessList ( dto );
	}


}
